﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="main.aspx.cs" Inherits="Dialog.main" %>
<%@ register src="~/dialogControl.ascx" tagname="DialogControl" tagprefix="ctrl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="<%= ResolveClientUrl("~/Scripts/jquery-1.5.1.min.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveClientUrl("~/Scripts/jquery-ui-1.8.10.custom.min.js") %>"></script>
    <link href="<%= Page.ResolveUrl("~/css/custom-theme/jquery-ui.css") %>" rel="stylesheet"
        type="text/css" media="screen,projector" />
    
    <script type="text/javascript">

        var thisAddDialog;
        var thatAddDialog;
        $(function () {



            //setup
            thisAddDialog = $("#dialog-inline").dialog({
                resizable: false,
                draggable: false,
                autoOpen: false,
                height: 250,
                width: 500,
                modal: true,
                buttons: {
                    'Yes': function () {
                        alert('clicked yes');

                    },
                    'No': function () {
                        $(this).dialog("close");
                    }
                }
            });



            var ctrlDialog = "#<%=myControlDialog.PanelClientId %>";
            thatAddDialog = $(ctrlDialog).dialog({
                resizable: false,
                draggable: false,
                autoOpen: false,
               
                modal: true,
                buttons: {
                    'Yes': function () {
                        alert('clicked yes');

                    },
                    'No': function () {
                        $(this).dialog("close");
                    }
                }
            });


            $('#Button1').click(function () {
                openInlineDialog();
            });


            $('#Button2').click(function () {
                openControlDialog();
            });


        });

        function openInlineDialog() {

            thisAddDialog.dialog('open');

        }


        function openControlDialog() {
           
            thatAddDialog.dialog('open');

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="dialog-inline" title='inline dialog'>
        <h1>
            Say hello to inline dialog</h1>
    </div>
    <ctrl:DialogControl ID="myControlDialog" Height="400" Width="460" runat="server" />
    <input id="Button1" type="button" value="inline" />
    <input id="Button2" type="button" value="control" />
    </form>
</body>
</html>
